//
//  AlbumsManager.h
//  DAlbum
//
//  Created by David Qiu on 15/9/7.
//  Copyright (C) 2015, David Qiu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>



/**
 *  Operation result of creating an album.
 */
typedef NS_ENUM(NSInteger, AlbumManagerCreateAlbumResult) {
    /**
     *  Succeeded in creating the album.
     */
    AlbumManagerCreateAlbumSucceeded,
    /**
     *  The album to create already exists.
     */
    AlbumManagerCreateAlbumExisting,
    /**
     *  Failed to create the album.
     */
    AlbumManagerCreateAlbumFailed
};



/**
 *  Operation result of deleting an album.
 */
typedef NS_ENUM(NSInteger, AlbumManagerDeleteAlbumResult) {
    /**
     *  Succeeded in deleting the album.
     */
    AlbumManagerDeleteAlbumSucceeded,
    /**
     *  The album to delete does not exist.
     */
    AlbumManagerDeleteAlbumInexistent,
    /**
     *  Failed to delete the album.
     */
    AlbumManagerDeleteAlbumFailed
};



/**
 *  Albums manager.
 */
@interface AlbumsManager : NSObject

/**
 *  The default albums manager.
 *
 *  @return The pointer to the default albums manager.
 */
+ (instancetype) defaultManager;


/**
 *  Name of currently selected album.
 */
@property (strong, nonatomic) NSString* selectedAlbumName;


/**
 *  Fetch the latest albums list.
 *
 *  @return An array of strings indicating the name of the latest albums list.
 */
- (NSArray *) albums;

/**
 *  Fetch the latest pictures list of currently selected album.
 *
 *  @return An array of strings indicating the file name of the latest pictures 
 *          in the currently selected album. A `nil` will be returned if the 
 *          currently selected album does not exist.
 */
- (NSArray *) pictures;

/**
 *  Fetch the data of a picture.
 *
 *  @param fileName  The file name of the picture to fetch.
 *  @param albumName The name of the album containing the picture.
 *
 *  @return The data of the fetched picture.
 */
- (UIImage *) pictureByFileName:(NSString *)fileName albumName:(NSString *)albumName;

/**
 *  Fetch the data of a thumbnail for a picture.
 *
 *  @param fileName  The corresponding picture file name of the thumbnail to fetch.
 *  @param albumName The name of the album containing the corresponding picture.
 *
 *  @return The data of the fetched thumbnail.
 */
- (UIImage *) thumbnailByPictureFileName:(NSString*)fileName albumName:(NSString *)albumName;


/**
 *  Create an album.
 *
 *  @param name The name of the album to create.
 *
 *  @return The operation result of creating the album.
 */
- (AlbumManagerCreateAlbumResult) createAlbumByName:(NSString *)name;

/**
 *  Delete an existing album.
 *
 *  @param name The name of the album to delete.
 *
 *  @return The operation result of deleting the album.
 */
- (AlbumManagerDeleteAlbumResult) deleteAlbumByName:(NSString *)name;

@end
